#include<stdio.h>
int cha, s, ceng, pep;
double cost=0;
int main()
{
	scanf("%d%d%d%d", &cha, &s, &ceng, &pep);
	if(cha == 1)
		cost += 0.6*s*12;
	if(cha == 2)
	{
		cost += 0.8*s*12;
		if(ceng>=2 && ceng<=5) cost += 8*12;
		else if(ceng>=6 && ceng<=15) cost += 10*12;
		else cost += 15*12;
	}
	cost += pep*3*12;
	printf("%.2lf", cost);
	return 0;
}
